var NH_Config = function () {

    return {
        init: function () {
            $.fn.modalmanager.defaults.resize = true;
            $.fn.modalmanager.defaults.spinner = '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><img src="assets/img/ajax-modal-loading.gif" align="middle">&nbsp;<span style="font-weight:300; color: #eee; font-size: 18px; font-family:Open Sans;">&nbsp;Đang tải...</span></div>';

            var $modal = $('#ajax-modal');
 
            $('#modal_ajax_btn_add_attendance_card').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_attendance_card_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_attendance_card').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_attendance_card_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_team').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_team_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_team').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_team_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_level').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_level_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_level').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_level_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_crew').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_crew_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_crew').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_crew_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_usercrew').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_usercrew_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_usercrew').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_usercrew_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_usertype').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');

                $modal.load('admin_config_usertype_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_usertype').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_usertype_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_userrank').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');

                $modal.load('admin_config_userrank_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_userrank').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_userrank_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_relationship').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');

                $modal.load('admin_config_relationship_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_relationship').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_relationship_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_examtype').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');

                $modal.load('admin_config_examtype_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_examtype').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_examtype_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('#modal_ajax_btn_add_examtime').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');

                $modal.load('admin_config_examtime_modal.php', 'action=insert', function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
 
            $('.modal_ajax_btn_update_examtime').on('click', function(){
                // create the backdrop and wait for next modal to be triggered
                $('body').modalmanager('loading');
		 
                $modal.load('admin_config_examtime_modal.php', 'action=update&option_id=' + $(this).parent().attr('option_id'), function(){
                    $modal.modal().on("hidden", function() {
                        $modal.empty();
                    });
                });
            });
            
        }
    };
}();